/*
 * @Descripttion: 用户聊天模块
 * @Author: 银河以北
 * @Date: 2021-08-18 17:22:11
 * @LastEditors: 银河以北
 * @LastEditTime: 2021-10-07 13:46:22
 */

import { request } from '@/utils/request'

/**
 * @Description: 用户获取聊天列表
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
export function getUserChatList() {
    return request({
        url: '/chat/blogChat/getUserChatList',
        method: 'GET',
    })
}


/**
 * @Description: 获取单个用户聊天内容
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface getChatContentListDataType {
    user_id: number,
    send_id: number,
    page: number,
    list_rows: number,
}
export function getChatContentList(data: getChatContentListDataType) {
    return request({
        url: '/chat/blogChat/getChatContentList',
        method: 'GET',
        params: data
    })
}

/**
 * @Description: 获取单个用户聊天内容
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface addChatUserDataType {
    userEmail: string,
}
export function addChatUser(data: addChatUserDataType) {
    return request({
        url: '/chat/blogChat/addChatUser',
        method: 'POST',
        data
    })
}

/**
 * @Description:删除聊天对象，但是不是删除聊天记录
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface deleteChatUserDataType {
    send_id: string,
}
export function deleteChatUser(data: deleteChatUserDataType) {
    return request({
        url: '/chat/blogChat/deleteChatUser',
        method: 'DELETE',
        data
    })
}

/**
 * @Description:创建、或加入新的群聊
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface addNewGroupChatDataType {
    groupChatName: string,
    clientId: string
}
export function addNewGroupChat(data: addNewGroupChatDataType) {
    return request({
        url: '/chat/blogChat/addNewGroupChat',
        method: 'POST',
        data
    })
}

/**
 * @Description:获取用户群聊列表
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
export function getUserGroupChatList() {
    return request({
        url: '/chat/blogChat/getUserGroupChatList',
        method: 'GET',
    })
}

/**
 * @Description:存储用户群发信息 并发送
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface sendGroupChatContentDataType {
    group_id: string,
    content: string
    groupId: string
}
export function sendGroupChatContent(data: sendGroupChatContentDataType) {
    return request({
        url: '/chat/blogChat/sendGroupChatContent',
        method: 'POST',
        data
    })
}

/**
 * @Description:存储用户群发信息 并发送
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */

interface getGroupChatMsgListDataType {
    groupId: number,
}
export function getGroupChatMsgList(data: getGroupChatMsgListDataType) {
    return request({
        url: '/chat/blogChat/getGroupChatMsgList',
        method: 'GET',
        params: data
    })
}


/**
 * @Description:存储用户群发信息 并发送
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface deleteGroupChatItemDataType {
    groupId: number,
}
export function deleteGroupChatItem(data: deleteGroupChatItemDataType) {
    return request({
        url: '/chat/blogChat/deleteGroupChatItem',
        method: 'DELETE',
        data
    })
}

/**
 * @Description:获取群组信息
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface dgetGroupChatInfoDataType {
    groupId: number,
}
export function getGroupChatInfo(data: dgetGroupChatInfoDataType) {
    return request({
        url: '/chat/blogChat/getGroupChatInfo',
        method: 'GET',
        params: data
    })
}


/**
 * @Description:获取群组信息
 * @Author: 银河以北
 * @Date: 2021-08-10 00:02:25
 * @param {*}
 * @return {*}
 */
interface deleteUserGroupChatItemDataType {
    groupId: number,
}
export function deleteUserGroupChatItem(data: deleteUserGroupChatItemDataType) {
    return request({
        url: '/chat/blogChat/deleteUserGroupChatItem',
        method: 'DELETE',
        data
    })
}






